package com.yuanfengPlus.basicInfoManage.paymode.controller;


import com.yuanfengPlus.basicInfoManage.paymode.mouel.PayModeDustbinInfo;
import com.yuanfengPlus.basicInfoManage.paymode.mouel.PayModeInfo;
import com.yuanfengPlus.basicInfoManage.paymode.service.impl.PayModeServiceImpl;
import com.yuanfengPlus.utils.PageResult;
import com.yuanfengPlus.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;
import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("/paymode")
@Api(tags = "支付方式管理")
public class PayModeController {
    @Resource
    private PayModeServiceImpl pmsi;
    @PostMapping("/insert")
    @ApiOperation("添加支付方式信息")
    public Result<String> insert(@RequestBody PayModeInfo payMethodInfo) {
        return pmsi.insert(payMethodInfo);
    }
    @PostMapping("/update")
    @ApiOperation("修改支付方式信息")
    public Result<String> update(@RequestBody PayModeInfo payMethodInfo) {
        return pmsi.update(payMethodInfo);
    }
    @PostMapping("/select")
    @ApiOperation("查询支付方式信息")
    public Result<PageResult> select(@RequestBody Map<String, Object> params) {
        return Result.success(pmsi.select(params));
    }
    @PostMapping("/selectAllDustbin")
    @ApiOperation("查询回收站支付方式信息")
    public Result<List<PayModeDustbinInfo>> selectAllDustbin() {
        return pmsi.selectAllDustbin();
    }
    @PostMapping("/delete")
    @ApiOperation("删除支付方式信息")
    public Result<String> delete( String payMethodId) {
        return pmsi.delete(payMethodId);
    }
}
